package com.forum.module.blog.dal.dataobject.article;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.forum.framework.mybatis.core.dataobject.BaseDO;

import java.util.Objects;

/**
 * 功能:
 * 作者:ouyzh
 * 日期:2025/3/2 17:47
 */
@TableName(value = "blog_article", autoResultMap = true)
public class ArticleDO extends BaseDO {
    /**
     * 编号
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 用户编号
     */
    private Long userId;

    /**
     * 文件标题
     */
    private String title;

    /**
     * 文章摘要
     */
    private String summary;

    /**
     * 文章内容
     */
    private String content;

    /**
     * 文章封面图URL
     */
    private String coverImage;

    /**
     * 文章分类编号
     */
    private Long categoryId;

    /**
     * 文章状态（0：草稿 1：发布 2：审核中）
     */
    private Integer status;

    /**
     * 浏览量
     */
    private Long views;

    /**
     * 点赞数
     */
    private Long likes;

    /**
     * 评论数
     */
    private Long comments;

    public ArticleDO() {
    }

    public ArticleDO(Long id, Long userId, String title, String summary, String content, String coverImage, Long categoryId, Integer status, Long views, Long likes, Long comments) {
        this.id = id;
        this.userId = userId;
        this.title = title;
        this.summary = summary;
        this.content = content;
        this.coverImage = coverImage;
        this.categoryId = categoryId;
        this.status = status;
        this.views = views;
        this.likes = likes;
        this.comments = comments;
    }

    public Long getId() {
        return id;
    }


    public ArticleDO setId(Long id) {
        this.id = id;
        return this;
    }

    public Long getUserId() {
        return userId;
    }

    public ArticleDO setUserId(Long userId) {
        this.userId = userId;
        return this;
    }

    public String getTitle() {
        return title;
    }

    public ArticleDO setTitle(String title) {
        this.title = title;
        return this;
    }

    public String getSummary() {
        return summary;
    }

    public ArticleDO setSummary(String summary) {
        this.summary = summary;
        return this;
    }

    public String getContent() {
        return content;
    }

    public ArticleDO setContent(String content) {
        this.content = content;
        return this;
    }

    public String getCoverImage() {
        return coverImage;
    }

    public ArticleDO setCoverImage(String coverImage) {
        this.coverImage = coverImage;
        return this;
    }

    public Long getCategoryId() {
        return categoryId;
    }

    public ArticleDO setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
        return this;
    }

    public Integer getStatus() {
        return status;
    }

    public ArticleDO setStatus(Integer status) {
        this.status = status;
        return this;
    }

    public Long getViews() {
        return views;
    }

    public ArticleDO setViews(Long views) {
        this.views = views;
        return this;
    }

    public Long getLikes() {
        return likes;
    }

    public ArticleDO setLikes(Long likes) {
        this.likes = likes;
        return this;
    }

    public Long getComments() {
        return comments;
    }

    public ArticleDO setComments(Long comments) {
        this.comments = comments;
        return this;
    }

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (object == null || getClass() != object.getClass()) return false;
        ArticleDO articleDO = (ArticleDO) object;
        return Objects.equals(id, articleDO.id) && Objects.equals(userId, articleDO.userId) && Objects.equals(title, articleDO.title) && Objects.equals(summary, articleDO.summary) && Objects.equals(content, articleDO.content) && Objects.equals(coverImage, articleDO.coverImage) && Objects.equals(categoryId, articleDO.categoryId) && Objects.equals(status, articleDO.status) && Objects.equals(views, articleDO.views) && Objects.equals(likes, articleDO.likes) && Objects.equals(comments, articleDO.comments);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, userId, title, summary, content, coverImage, categoryId, status, views, likes, comments);
    }
}
